<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>角色管理</title>
	<%@ include file="../../include/head.jsp"%>
</head>
<body>
<div class="admin-content">
	<div class="am-g">
		<div class="am-u-sm-12">
			<div class="am-panel-group" id="accordion" style="display: none;">
				<div class="am-panel am-panel-default">
					<div class="am-panel-hd">
						<h4 class="am-panel-title" data-am-collapse="{parent: '#accordion', target: '#tab1'}">
							查询条件
						</h4>
					</div>
					<div id="tab1" class="am-panel-collapse am-collapse am-in">
						<div class="am-panel-bd">
							<form id="searchForm" action="${ctx}/role" method="post">
								<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
								<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
								<div class="am-form-group">
									<button type="submit" class="am-btn am-btn-success" onclick="initSearchForm()"><i class="am-icon-search"></i> 查询</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd">
					<h4 class="am-panel-title">
						查询列表
						<shiro:hasPermission name="sys:role:edit">
						<button type="button" class="am-btn am-btn-primary am-btn-xs iu-right"
								onclick="openModel('新增','${ctx}/role/update')"><span class="am-icon-plus"></span> 新增
						</button>
						</shiro:hasPermission>
					</h4>
				</div>
				<div class="am-panel-collapse am-collapse am-in">
					<div class="am-panel-bd">
						<div class="am-g">
							<div class="am-u-sm-12">
								<table id="contentTable"
									   class="am-table am-table-striped am-table-hover table-main">
									<thead>
									<tr>
										<th>序号</th>
										<th>归属机构</th>
										<th>角色名称</th>
										<th>角色标识</th>
										<th>是否可用</th>
										<th>备注</th>
										<th>操作</th>
									</tr>
									</thead>
									<tbody>
									<c:forEach items="${page.list}" var="role" varStatus="status">
										<tr>
											<td>${status.index+1}</td>
											<td>${role.organization.name}</td>
											<td>${role.name}</td>
											<td>${role.role}</td>
											<td>${role.available?'<span class="am-badge am-badge-success am-radius">可用</span>':'<span class="am-badge am-badge-danger am-radius">禁用</span>'}</td>
											<td>${role.remarks}</td>
											<td>
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<shiro:hasPermission name="sys:role:view">
															<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="openModel('编辑','${ctx}/role/update?id=${role.id}')"><span class="am-icon-pencil-square-o"></span> 编辑</button>
														</shiro:hasPermission>
														<shiro:hasPermission name="sys:role:edit">
															<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="iuConfirm('确认要删除该条数据吗？', '${ctx}/role/delete?id=${role.id}&pageNo=${page.pageNo}&pageSize=${page.pageSize}')"><span class="am-icon-trash-o"></span> 删除</button>
														</shiro:hasPermission>
													</div>
												</div>
											</td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="am-u-sm-12">
								<%@ include file="../../utils/pagination.jsp" %>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="../../include/bottom.jsp"%>
<script type="text/javascript">
	$(document).ready(function() {
		var msg = '${msg}';
		if(msg!=''){
			iuMsg(msg);
		}
	});
</script>
</body>
</html>